package com.example.myshop.vo;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;
import java.util.Objects;
@Data
public class OrderVO implements Serializable {
    @JsonSerialize(using = ToStringSerializer.class)
    private Long uid;
    @JsonSerialize(using = ToStringSerializer.class)
    private Long pid;
    @JsonSerialize(using = ToStringSerializer.class)
    private Long oid;
    @JsonSerialize(using = ToStringSerializer.class)
    private Long businessId;
    @JsonSerialize(using = ToStringSerializer.class)
    private Long price;
    private Integer num;
    private Date orderTime;
    private Date payTime;

    private String recvName;
    private String title;
    @JsonSerialize(using = ToStringSerializer.class)
    private Long realPrice;
    private String image;
    private Integer pStatus;


    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof OrderVO)) return false;
        OrderVO orderVO = (OrderVO) o;
        return Objects.equals(getUid(), orderVO.getUid()) &&
                Objects.equals(getPid(), orderVO.getPid()) &&
                Objects.equals(getOid(), orderVO.getOid()) &&
                Objects.equals(getBusinessId(), orderVO.getBusinessId()) &&
                Objects.equals(getPrice(), orderVO.getPrice()) &&
                Objects.equals(getNum(), orderVO.getNum()) &&
                Objects.equals(getOrderTime(), orderVO.getOrderTime()) &&
                Objects.equals(payTime, orderVO.payTime) &&
                Objects.equals(getRecvName(), orderVO.getRecvName()) &&
                Objects.equals(getTitle(), orderVO.getTitle()) &&
                Objects.equals(getRealPrice(), orderVO.getRealPrice()) &&
                Objects.equals(getImage(), orderVO.getImage()) &&
                Objects.equals(getPStatus(), orderVO.getPStatus());
    }

    @Override
    public int hashCode() {
        return Objects.hash(getUid(), getPid(), getOid(), getBusinessId(), getPrice(), getNum(), getOrderTime(), payTime, getRecvName(), getTitle(), getRealPrice(), getImage(), getPStatus());
    }

    @Override
    public String toString() {
        return "OrderVO{" +
                "uid=" + uid +
                ", pid=" + pid +
                ", oid=" + oid +
                ", businessId=" + businessId +
                ", price=" + price +
                ", num=" + num +
                ", orderTime=" + orderTime +
                ", payTime=" + payTime +
                ", recvName='" + recvName + '\'' +
                ", title='" + title + '\'' +
                ", realPrice=" + realPrice +
                ", image='" + image + '\'' +
                ", pStatus=" + pStatus +
                '}';
    }



}
